/**
 * @author Hanpeng
 * @date 2022/1/14 15:22
 * @description:
 */
object OneHundredDrink {
  def buyDrink(gaizi:Int,pingzi:Int): Int ={
      //
    val gaiziForOneDrink:Int=5  //5个盖子一瓶酒
    val pingziForOneDrink:Int=3  //3个瓶子一瓶酒
    val gaiBuyDrink: Int = gaizi/gaiziForOneDrink  //盖子买的酒
    val pingBuyDrink: Int = pingzi/pingziForOneDrink  //瓶子买的酒
    if(gaiBuyDrink==0&&pingBuyDrink==0) {
      0
    }else {
      val gaiBuyDrinkLeft: Int = gaizi%gaiziForOneDrink  //盖子买的酒剩余的盖子
      val pingBuyDrinkLeft: Int = pingzi%pingziForOneDrink  //瓶子买的酒剩余的瓶子
      val totalDrink = gaiBuyDrink + pingBuyDrink;//本轮买的酒的总数
      val gaiziMy = gaiBuyDrinkLeft + totalDrink //拥有的盖子
      val pingziMy = pingBuyDrinkLeft + totalDrink //拥有的瓶子
      totalDrink+buyDrink(gaiziMy,pingziMy)
    }
  }
  def main(args: Array[String]): Unit = {
    var total:Int=100/2  //第一次买的啤酒数目
    var gaizi:Int=total
    var pingzi:Int=total
    println(total+buyDrink(gaizi,pingzi))
  }
}
